/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Valuador.java
 *
 * Created on 24-oct-2009, 19:43:52
 */

package scapi.gui;

import com.jidesoft.swing.AutoCompletion;
import com.jidesoft.swing.AutoCompletionComboBox;
import com.jidesoft.swing.SelectAllUtils;
import java.awt.Component;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.Date;
import java.util.NoSuchElementException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import scapi.entidades.Direccion;
import scapi.entidades.EsperadorCajero;
import scapi.entidades.Joya;
import scapi.entidades.Pignorante;
import scapi.entidades.Prenda;
import scapi.entidades.Producto;
import scapi.servidor.servidores.ServidorAPignorante;
import scapi.servidor.servidores.ServidorCola;
import scapi.utilerias.EValidacion;
import scapi.utilerias.ExcepcionValidacion;
import scapi.utilerias.ServidorFactory;

/**
 *
 * @author Admin
 */
public class Registrador extends javax.swing.JFrame {
    private ServidorCola servCola;
    private ServidorAPignorante servPignorante;
    private Producto producto;

   // BD bd = new BD();
    /** Creates new form Valuador */
    public Registrador() {
        try {

           servCola = (ServidorCola) ServidorFactory.obtenerServidor(ServidorFactory.ServidorCola);
           servPignorante = (ServidorAPignorante) ServidorFactory.obtenerServidor(ServidorFactory.ServidorPignorante);

            
        } catch (RemoteException ex) {
           JOptionPane.showMessageDialog(this, "Imposible conectar a servidor","ERROR", JOptionPane.ERROR_MESSAGE);
        } catch(Exception e){
            e.printStackTrace();
        }
        
        initComponents();
        /*
        pnJoya.setVisible(false);
        pnProducto.setVisible(false);
*/
        pnCaracter.remove(pnJoya);
        pnCaracter.remove(pnProducto);
        try {
            Object[] consulta = servPignorante.consultaTodo();
            jcmbNombre.setModel(new DefaultComboBoxModel(consulta));
        } catch (SQLException ex) {
            Logger.getLogger(Registrador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            Logger.getLogger(Registrador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParseException ex) {
            Logger.getLogger(Registrador.class.getName()).log(Level.SEVERE, null, ex);
        }
      




        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btgSexo = new javax.swing.ButtonGroup();
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel7 = new javax.swing.JPanel();
        pnTitulo = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        pnDtPignorante = new javax.swing.JPanel();
        lblNombre = new javax.swing.JLabel();
        lblApellidos = new javax.swing.JLabel();
        jTxtApPaterno = new javax.swing.JTextField();
        lblFecNac = new javax.swing.JLabel();
        lblSexo = new javax.swing.JLabel();
        lblTelefono = new javax.swing.JLabel();
        jTxtTelefono = new javax.swing.JTextField();
        lblEmail = new javax.swing.JLabel();
        jTxtEmail = new javax.swing.JTextField();
        lblRFC = new javax.swing.JLabel();
        jTxtRfc = new javax.swing.JTextField();
        jTxtApMaterno = new javax.swing.JTextField();
        rbHombre = new javax.swing.JRadioButton();
        rdButMujer = new javax.swing.JRadioButton();
        pnDireccion = new javax.swing.JPanel();
        lblCalle = new javax.swing.JLabel();
        lblNumero = new javax.swing.JLabel();
        lblColonia = new javax.swing.JLabel();
        lblCodigo = new javax.swing.JLabel();
        lblDelegacion = new javax.swing.JLabel();
        lblEstado = new javax.swing.JLabel();
        jTxtCalle = new javax.swing.JTextField();
        jTxtNumero = new javax.swing.JTextField();
        jTxtColonia = new javax.swing.JTextField();
        jTxtCpostal = new javax.swing.JTextField();
        jTxtxDelegacion = new javax.swing.JTextField();
        jTxtNumero2 = new javax.swing.JTextField();
        jTxtEstado = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jTxtLada = new javax.swing.JTextField();
        dtFecha = new com.toedter.calendar.JDateChooser();
        jTxtNombre = new javax.swing.JTextField();
        pnPrenda = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTxtNombreProd = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTxtDescripcionProd = new javax.swing.JTextArea();
        jCbEstado = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        pnCaracter = new javax.swing.JPanel();
        pnJoya = new javax.swing.JPanel();
        jTxtPurezaProd = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jTxtPesoProd = new javax.swing.JTextField();
        jTxtMaterialProd = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        pnProducto = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jTxtMarcaProd = new javax.swing.JTextField();
        jTxtModeloProd = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        btnAceptar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        lblNombre1 = new javax.swing.JLabel();
        jcmbNombre = new AutoCompletionComboBox();
        jButton3 = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(900, 700));
        setResizable(false);

        pnTitulo.setLayout(new java.awt.GridLayout(2, 1));

        jToolBar1.setRollover(true);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/product32.png"))); // NOI18N
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/exit32.png"))); // NOI18N
        jButton2.setFocusable(false);
        jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton2);

        pnTitulo.add(jToolBar1);

        jLabel3.setFont(new java.awt.Font("DejaVu Sans", 0, 24));
        jLabel3.setText("Registrador");
        jPanel5.add(jLabel3);

        pnTitulo.add(jPanel5);

        getContentPane().add(pnTitulo, java.awt.BorderLayout.PAGE_START);

        pnDtPignorante.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pignorante"));

        lblNombre.setText("Nombre");

        lblApellidos.setText("Apellidos");

        lblFecNac.setText("Fec Nac");

        lblSexo.setText("Sexo");

        lblTelefono.setText("Telefono");

        lblEmail.setText("E-Mail");

        lblRFC.setText("RFC");

        buttonGroup1.add(rbHombre);
        rbHombre.setSelected(true);
        rbHombre.setText("Hombre");
        rbHombre.setActionCommand("h");

        buttonGroup1.add(rdButMujer);
        rdButMujer.setText("Mujer");
        rdButMujer.setActionCommand("m");
        rdButMujer.setFocusable(false);

        pnDireccion.setBorder(javax.swing.BorderFactory.createTitledBorder("Direccion"));

        lblCalle.setText("Calle");

        lblNumero.setText("Numero");

        lblColonia.setText("Colonia");

        lblCodigo.setText("C.P.");

        lblDelegacion.setText("Delegacion");

        lblEstado.setText("Estado");

        jTxtEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Aguascalientes", "Baja California", "Baja California Sur", "Campeche", "Coahuila", "Colima", "Chiapas", "Chihuahua", "Distrito Federal", "Durango", "Estado de México", "Guanajuato", "Guerrero", "Hidalgo", "Jalisco", "Michoacán", "Morelos", "Nayarit", "Nuevo León", "Oaxaca", "Puebla", "Querétaro", "Quintana Roo", "San Luis Potosí", "Sinaloa", "Sonora", "Tabasco", "Tamaulipas", "Tlaxcala", "Veracruz", "Yucatán", "Zacatecas" }));

        javax.swing.GroupLayout pnDireccionLayout = new javax.swing.GroupLayout(pnDireccion);
        pnDireccion.setLayout(pnDireccionLayout);
        pnDireccionLayout.setHorizontalGroup(
            pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDireccionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCodigo)
                    .addComponent(lblColonia)
                    .addGroup(pnDireccionLayout.createSequentialGroup()
                        .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDelegacion)
                            .addComponent(lblCalle)
                            .addComponent(lblNumero))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTxtCalle, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                            .addGroup(pnDireccionLayout.createSequentialGroup()
                                .addComponent(jTxtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTxtNumero2, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE))
                            .addComponent(jTxtColonia, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                            .addComponent(jTxtCpostal, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTxtxDelegacion, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                            .addComponent(jTxtEstado, 0, 221, Short.MAX_VALUE)))
                    .addComponent(lblEstado))
                .addGap(24, 24, 24))
        );
        pnDireccionLayout.setVerticalGroup(
            pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDireccionLayout.createSequentialGroup()
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCalle)
                    .addComponent(jTxtCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumero)
                    .addComponent(jTxtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTxtNumero2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblColonia)
                    .addComponent(jTxtColonia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCodigo)
                    .addComponent(jTxtCpostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDelegacion)
                    .addComponent(jTxtxDelegacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEstado)
                    .addComponent(jTxtEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnDtPignoranteLayout = new javax.swing.GroupLayout(pnDtPignorante);
        pnDtPignorante.setLayout(pnDtPignoranteLayout);
        pnDtPignoranteLayout.setHorizontalGroup(
            pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                .addComponent(lblSexo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 469, Short.MAX_VALUE))
                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblApellidos)
                                    .addComponent(lblNombre)
                                    .addComponent(lblFecNac)
                                    .addComponent(lblRFC)
                                    .addComponent(lblEmail))
                                .addGap(22, 22, 22)
                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTxtRfc, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDtPignoranteLayout.createSequentialGroup()
                                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jTxtNombre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                                            .addComponent(jTxtEmail, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnDtPignoranteLayout.createSequentialGroup()
                                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(rbHombre)
                                                    .addComponent(jTxtLada, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jTxtTelefono, javax.swing.GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE)
                                                    .addComponent(rdButMujer)))
                                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(dtFecha, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                                                    .addComponent(jTxtApPaterno, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(jTxtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(30, 30, 30))))
                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                .addComponent(lblTelefono)
                                .addGap(477, 477, 477)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(159, 159, 159)))
                .addContainerGap())
        );
        pnDtPignoranteLayout.setVerticalGroup(
            pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDtPignoranteLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                        .addComponent(pnDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDtPignoranteLayout.createSequentialGroup()
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblNombre)
                            .addComponent(jTxtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblApellidos)
                            .addComponent(jTxtApPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTxtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblFecNac)
                            .addComponent(dtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblSexo)
                                    .addComponent(rbHombre))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(lblTelefono)
                                    .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jTxtLada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jTxtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(rdButMujer))
                        .addGap(18, 18, 18)
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTxtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblEmail))
                        .addGap(9, 9, 9)
                        .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnDtPignoranteLayout.createSequentialGroup()
                                .addGap(98, 98, 98)
                                .addComponent(jLabel10))
                            .addGroup(pnDtPignoranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(lblRFC)
                                .addComponent(jTxtRfc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))
        );

        pnPrenda.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del producto"));

        jLabel1.setText("Nombre");

        jLabel2.setText("Descripcion");

        jTxtNombreProd.setEditable(false);

        jTxtDescripcionProd.setColumns(20);
        jTxtDescripcionProd.setEditable(false);
        jTxtDescripcionProd.setRows(5);
        jScrollPane1.setViewportView(jTxtDescripcionProd);

        jCbEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Excelente", "Bueno", "Regular", "Malo" }));
        jCbEstado.setEnabled(false);

        jLabel4.setText("Estado");

        pnCaracter.setLayout(new java.awt.GridLayout(2, 1));

        jTxtPurezaProd.setEditable(false);

        jLabel9.setText("Puresa");

        jLabel8.setText("Peso");

        jTxtPesoProd.setEditable(false);

        jTxtMaterialProd.setEditable(false);

        jLabel7.setText("Material");

        javax.swing.GroupLayout pnJoyaLayout = new javax.swing.GroupLayout(pnJoya);
        pnJoya.setLayout(pnJoyaLayout);
        pnJoyaLayout.setHorizontalGroup(
            pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnJoyaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTxtPesoProd)
                    .addComponent(jTxtMaterialProd, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
                    .addComponent(jTxtPurezaProd))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        pnJoyaLayout.setVerticalGroup(
            pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnJoyaLayout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTxtMaterialProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jTxtPesoProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnJoyaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTxtPurezaProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnCaracter.add(pnJoya);

        jLabel5.setText("Marca");

        jTxtMarcaProd.setEditable(false);

        jTxtModeloProd.setEditable(false);

        jLabel6.setText("Modelo");

        javax.swing.GroupLayout pnProductoLayout = new javax.swing.GroupLayout(pnProducto);
        pnProducto.setLayout(pnProductoLayout);
        pnProductoLayout.setHorizontalGroup(
            pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnProductoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addGroup(pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTxtModeloProd)
                    .addComponent(jTxtMarcaProd, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnProductoLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel5)
                    .addContainerGap(256, Short.MAX_VALUE)))
        );
        pnProductoLayout.setVerticalGroup(
            pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnProductoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTxtMarcaProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jTxtModeloProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(26, Short.MAX_VALUE))
            .addGroup(pnProductoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnProductoLayout.createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addComponent(jLabel5)
                    .addContainerGap(61, Short.MAX_VALUE)))
        );

        pnCaracter.add(pnProducto);

        javax.swing.GroupLayout pnPrendaLayout = new javax.swing.GroupLayout(pnPrenda);
        pnPrenda.setLayout(pnPrendaLayout);
        pnPrendaLayout.setHorizontalGroup(
            pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnPrendaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnPrendaLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(37, 37, 37)
                        .addComponent(jTxtNombreProd))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnPrendaLayout.createSequentialGroup()
                        .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jCbEstado, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane1))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnCaracter, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(65, Short.MAX_VALUE))
        );
        pnPrendaLayout.setVerticalGroup(
            pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnPrendaLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pnCaracter, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pnPrendaLayout.createSequentialGroup()
                        .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jTxtNombreProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(14, 14, 14)
                        .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(41, 41, 41)
                        .addGroup(pnPrendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4)
                            .addComponent(jCbEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/ok.png"))); // NOI18N
        btnAceptar.setText("Aceptar");
        btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptarActionPerformed(evt);
            }
        });

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/borrar.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        lblNombre1.setText("Busqueda Nombre");

        jcmbNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbNombreActionPerformed(evt);
            }
        });

        jButton3.setText("Aceptar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblNombre1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcmbNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombre1)
                    .addComponent(jcmbNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(pnPrenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                            .addComponent(btnAceptar, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)))
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnDtPignorante, javax.swing.GroupLayout.PREFERRED_SIZE, 920, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(210, 210, 210))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7)
                .addComponent(pnDtPignorante, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(btnAceptar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnCancelar))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnPrenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(598, 598, 598))
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jMenu1.setText("Archivo");

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/exit.png"))); // NOI18N
        jMenuItem1.setText("Salir");
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Salir");

        jMenuItem2.setText("About");
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarActionPerformed
        try{
             //VALIDACION Y CREACION DE PERSONA
            String nombre = EValidacion.cadenaCorrecta(""+jTxtNombre.getText(),"Nombre");
                String apPaterno = EValidacion.cadenaCorrecta(jTxtApPaterno.getText(), "Apelldio Paterno");
                String apMaterno = EValidacion.cadenaCorrecta(jTxtApMaterno.getText(),"Apellido Materno");
                Date fechaNac = dtFecha.getDate();
                char sexo;
                    if(rdButMujer.isSelected())
                      sexo = 'm';
                    else
                      sexo = 'h';
                int numero= EValidacion.telefono(jTxtTelefono.getText(),"Telefono");
                int lada = EValidacion.numeroCorrecto(jTxtLada.getText(),"Lada");
                String email = EValidacion.email(jTxtEmail.getText(),"E-mail");
                String rfc = EValidacion.RFC(jTxtRfc.getText(),"RFC");
                
            String calle = EValidacion.vacio(jTxtCalle.getText(),"Calle");
                int numeroExt = EValidacion.numeroCorrecto(jTxtNumero.getText(),"Numero Exterior");
                int numeroInt = EValidacion.numeroCorrecto(jTxtNumero2.getText(),"Numero Interior");
                String colonia = EValidacion.vacio(jTxtColonia.getText(),"Colonia");
                int codPostal = EValidacion.entero(EValidacion.vacio(jTxtCpostal.getText(),"Codigo Postal"),"Codigo Postal");
                String delegacion = EValidacion.cadenaCorrecta(jTxtxDelegacion.getText(),"Delegacion");
                String estado = (String) jTxtEstado.getSelectedItem();
                //String pais = EValidacion.cadenaCorrecta(jTxtPais.getText(),"Pais");
              //crea objeto direccion
            Direccion nuevaDireccion = new Direccion(calle, ""+numeroInt, numeroExt, colonia, codPostal, delegacion, estado, "Mexico");
            
                

              //crea objeto persona
            Pignorante persona = new Pignorante(0, nombre, apPaterno, apMaterno, fechaNac, sexo, lada, numero, nuevaDireccion, email, rfc,"");
            
          //VALIDACION Y CREACION DE PRODUCTO
           // String nombreProd = EValidacion.campoVacio(jTxtNombreProd.getText(),"Nombre de Producto");
            //String descripcion = EValidacion.campoVacio(jTxtDescripcionProd.getText(),"Descripcion") + "  Marca: " + jTxtMarcaProd.getText()+ "  Modelo: " + jTxtModeloProd.getText() ;
            //String presentacion = EValidacion.campoVacio(jTxtMaterialProd.getText(),"Material") + "  Pureza: " + jTxtPurezaProd.getText() ;
            //String estadoProd = jCbEstado.getSelectedItem().toString();

            //crea Prdocuto
//            Producto producto = new Producto(0, nombreProd, descripcion, presentacion, estadoProd);
           

            servCola.addColaCajero(1, new EsperadorCajero(producto,persona));
            JOptionPane.showMessageDialog(this, "Alta Exitosa");
            limpiarForm();
            
        }catch(ExcepcionValidacion e){
            JOptionPane.showMessageDialog(this,e.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
        }catch(RemoteException e){
            e.printStackTrace();
        }


    }//GEN-LAST:event_btnAceptarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        llenarProducto();



    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

        System.exit(0);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed

        System.exit(0);
        // TODO add your handling code here:
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void jcmbNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcmbNombreActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        Pignorante pign = (Pignorante)jcmbNombre.getSelectedItem();
        LlenarPignorante(pign);

        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void llenarProducto(){
        try {
            this.producto = servCola.sigColaRegistrador(1);
            Joya joya = null;
            Prenda prenda = null;

            if(producto instanceof Joya){
                joya = (Joya) producto;
                pnCaracter.add(pnJoya);
                pnCaracter.revalidate();

                jTxtMaterialProd.setText(joya.getMaterial());
                jTxtPesoProd.setText(""+joya.getPeso());
                jTxtPurezaProd.setText(""+joya.getPuresa());




            } else{
                prenda = (Prenda) producto;
                pnCaracter.add(pnProducto);
                pnCaracter.revalidate();
                jTxtMarcaProd.setText(prenda.getMarca());
                jTxtModeloProd.setText(prenda.getModelo());


            }
            
            jTxtNombreProd.setText(producto.getNombre());
            jTxtDescripcionProd.setText(producto.getDescripcion());
            jCbEstado.setSelectedItem(producto.getPresentacion());
            



        }  catch (RemoteException ex) {
           ex.printStackTrace();
        } catch(NoSuchElementException ex){
            JOptionPane.showMessageDialog(this, "No se han encontrado productos","ERROR" , JOptionPane.ERROR_MESSAGE);
        }

        
    }

    private void LlenarPignorante(Pignorante pignorante){
        Direccion dir = pignorante.getDireccion();

        jTxtNombre.setText(pignorante.getNombre());
        jTxtApPaterno.setText(pignorante.getApPaterno());
        jTxtApMaterno.setText(pignorante.getApMaterno());
        jTxtEmail.setText(pignorante.getEmail());
        jTxtLada.setText(""+pignorante.getLada());
        jTxtRfc.setText(pignorante.getRfc());
        jTxtTelefono.setText(""+pignorante.getTelefono());
        jTxtCalle.setText(dir.getCalle());
        jTxtColonia.setText(dir.getColonia());
        jTxtCpostal.setText(""+dir.getCodPostal());
        jTxtEstado.setSelectedItem(dir.getEstado());
        dtFecha.setDate(pignorante.getDtFechaNac());
        jTxtNumero.setText(dir.getNumInt());
        jTxtNumero2.setText(""+dir.getNumExt());
        jTxtxDelegacion.setText(dir.getDelegacion());

    }

    private void limpiarPanel(JPanel panel){
        Component[] comp = panel.getComponents();
        for (int i = 0; i < comp.length; i++) {
            Component component = comp[i];
            if(component instanceof JTextField){
                JTextField componente = (JTextField) component;
                componente.setText("");
            }else if(component instanceof JComboBox){
                JComboBox comp2 = (JComboBox) component;
                comp2.setSelectedIndex(0);

            }else if(component instanceof JCheckBox){
                JCheckBox box = (JCheckBox) component;
                box.setSelected(false);
            }

        }

    }

    private void limpiarForm(){
        limpiarPanel(pnDireccion);
        limpiarPanel(pnDtPignorante);
        limpiarPanel(pnJoya);
        limpiarPanel(pnPrenda);
        limpiarPanel(pnProducto);
        jTxtDescripcionProd.setText("");
        pnCaracter.remove(pnJoya);
        pnCaracter.remove(pnProducto);
        pnPrenda.revalidate();

    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Registrador().setVisible(true);
            }
        });
    }

    public static void iniciar() {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Registrador().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup btgSexo;
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private com.toedter.calendar.JDateChooser dtFecha;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JComboBox jCbEstado;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTextField jTxtApMaterno;
    private javax.swing.JTextField jTxtApPaterno;
    private javax.swing.JTextField jTxtCalle;
    private javax.swing.JTextField jTxtColonia;
    private javax.swing.JTextField jTxtCpostal;
    private javax.swing.JTextArea jTxtDescripcionProd;
    private javax.swing.JTextField jTxtEmail;
    private javax.swing.JComboBox jTxtEstado;
    private javax.swing.JTextField jTxtLada;
    private javax.swing.JTextField jTxtMarcaProd;
    private javax.swing.JTextField jTxtMaterialProd;
    private javax.swing.JTextField jTxtModeloProd;
    private javax.swing.JTextField jTxtNombre;
    private javax.swing.JTextField jTxtNombreProd;
    private javax.swing.JTextField jTxtNumero;
    private javax.swing.JTextField jTxtNumero2;
    private javax.swing.JTextField jTxtPesoProd;
    private javax.swing.JTextField jTxtPurezaProd;
    private javax.swing.JTextField jTxtRfc;
    private javax.swing.JTextField jTxtTelefono;
    private javax.swing.JTextField jTxtxDelegacion;
    private javax.swing.JComboBox jcmbNombre;
    private javax.swing.JLabel lblApellidos;
    private javax.swing.JLabel lblCalle;
    private javax.swing.JLabel lblCodigo;
    private javax.swing.JLabel lblColonia;
    private javax.swing.JLabel lblDelegacion;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblEstado;
    private javax.swing.JLabel lblFecNac;
    private javax.swing.JLabel lblNombre;
    private javax.swing.JLabel lblNombre1;
    private javax.swing.JLabel lblNumero;
    private javax.swing.JLabel lblRFC;
    private javax.swing.JLabel lblSexo;
    private javax.swing.JLabel lblTelefono;
    private javax.swing.JPanel pnCaracter;
    private javax.swing.JPanel pnDireccion;
    private javax.swing.JPanel pnDtPignorante;
    private javax.swing.JPanel pnJoya;
    private javax.swing.JPanel pnPrenda;
    private javax.swing.JPanel pnProducto;
    private javax.swing.JPanel pnTitulo;
    private javax.swing.JRadioButton rbHombre;
    private javax.swing.JRadioButton rdButMujer;
    // End of variables declaration//GEN-END:variables

}
